<?php
	require('Header_iframe.php');
?>
<html>
<head>
</head>

<body class="small">
<br>
<table cellspacing=20> 
<tr>
<td>
<?php
 $passkey= $_GET['passkey'];
 $fb_id=$_GET['fb_id'];
 $ulink=$_GET['ulink'];
 $student_id=$_GET['student_id'];

 //now lets get the expected key
 $sql="select confirm_code from fb_users where user_id=$fb_id";
 $result = $db->Execute($sql);
 $confirm_code= $result->fields['confirm_code'];
 if($confirm_code == $passkey){
    //success, now lets update the ulink and student id, and set the reach_verified flag so they can use other pages
    $sql="update fb_users set reach_verified=1, ulink_id='$ulink', student_id=$student_id where user_id=$fb_id";
	$db->Execute($sql);

    echo "Your ULink ID has now been verified by Study Buddies. Thank you! Now you can view your courses and start using the application. If you have any questions along the way, please refer to the help page or contact REACH. ";
    echo "<br><br>";
    echo "Remember to ask professors before you upload any documents which might be against University academic code. Thank you for helping the academic community at REACH! Click <a href=\"http://apps.facebook.com/studybuddies/Courses.php\" target=\"_top\"> here </a> to view your courses or request more. ";
  }
  else{
    echo "Something went wrong...please try again or report to Reach a password verification error has occurred.";
  }
?>
</td></tr>
</table>
</body>
</html>
